package ex02.zqli;

import java.io.*;
import java.net.Socket;

public class Main2 {

    public static void main(String[] args) throws IOException {


        Socket socket = new Socket("127.0.0.1", 8080);
        OutputStream outputStream = socket.getOutputStream();
        PrintWriter out = new PrintWriter(outputStream, true);
        // 给指定 ip 地址发送一个 http 请求
        out.println("GET /index.jsp HTTP/1.1"); // 请求办法 uri 协议
        out.println("Host: localhost:8080"); // 请求头
        out.println("Connection: keep-alive");
        out.println();


        BufferedReader in = new BufferedReader(new InputStreamReader(socket.getInputStream()));
    }
}
